package io.bitmax.exchange.base.model;

import android.content.res.Resources;
import android.text.TextUtils;

import io.bitmax.exchange.R;
import io.bitmax.library.core.BaseCoreApplication;
import io.bitmax.library.utils.RegularUtils;
import io.bitmax.library.utils.ToastUtils;

/**
 * Created by gongdongyang on 2018/9/26.
 */

public class BaseModel {

    protected Resources resources;

    public BaseModel() {
        resources = BaseCoreApplication.getInstance().getResources();
    }

    public boolean checkPhone(String phone) {
        if (TextUtils.isEmpty(phone)) {
            ToastUtils.showToast(resources.getString(R.string.app_phone_cannot_null));
            return false;
        } else if (!RegularUtils.isValidLoginName(phone)) {
            ToastUtils.showToast(resources.getString(R.string.app_phone_invalide));
            return false;
        }

        return true;
    }
}
